<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="col">
    <nav aria-label="Page navigation">
        <ul class="pagination justify-content-center" id="pageUI">
            <li class="page-item"><a class="first page-link ">首页</a></li>
            <li class="page-item"><a class="pre page-link">上一页</a></li>
            <li class="page-item"><a class="next page-link">下一页</a></li>
            <li class="page-item"><a class="last page-link">尾页</a></li>
            <li class="page-item"><a class="pageCurrent page-link">当前页(1)</a></li>
        </ul>
    </nav>
</div>

<script>
    $(function () {
        // console.log($(".page-wrapper").data("categoryId"));
        $("#pageUI").on("click",".first,.pre,.next,.last",doJumpToPage);
    });

    function doJumpToPage() {
        //获取绑定数据-当前页面
        let pageCurrent = $("#goodsTotal").data("pageCurrent");
        let pageCount = $("#goodsTotal").data("pageCount");
        // console.log(pageCount);
        let cls = $(this).prop("class");
        if (cls.indexOf("first") >= 0) {
            pageCurrent =1;
        }else if (cls.indexOf("pre") >= 0 && pageCurrent>1) {
            pageCurrent--;
        }else if (cls.indexOf("next") >= 0 && pageCurrent<pageCount) {
            pageCurrent++;
        }else if (cls.indexOf("last") >= 0) {
            pageCurrent = pageCount;
        }else{
            return;
        }
        //存储当前的页码值
        $("#goodsTotal").data("pageCurrent",pageCurrent);
        //进行刷新
        getObject();
    }
</script>
</body>
</html>